<?php
include("mysqlcon.php");
include("ok.php");
include("error.php");
include("userid.php");
   $userlist_id=$_GET["userlist_id"];
   $userlist_password = $_POST[userlist_password];
   $save_userlist_password= md5($userlist_password);
   $group_id = $_POST[group_id];
   $userlist_name = $_POST[userlist_name];
   $userlist_surname = $_POST[userlist_surname];
	
	if($error==false){
      mysql_select_db($dbname,$conn);
      mysql_query('SET NAMES utf8');
	
	  //update user data
		if($userlist_password!="")
	  		$update_user = "UPDATE `userlist` SET `userlist_password` = '$save_userlist_password',`group_id` = '$group_id',`userlist_name` = '$userlist_name',`userlist_surname` = '$userlist_surname' WHERE `userlist_id` = $userlist_id LIMIT 1";
		else
			$update_user = "UPDATE `userlist` SET `group_id` = '$group_id',`userlist_name` = '$userlist_name',`userlist_surname` = '$userlist_surname' WHERE `userlist_id` = $userlist_id LIMIT 1";
	echo $update_user;
      if(!mysql_query($update_user,$conn))
				   error_page("ฐานข้อมูลผิดพลาด $strSQL");
				else 
				{
				   $ok_text = "";
				   ok_page("แก้ไขข้อมูลผู้ใช้ เรียบร้อย","ระบบทำการจัดเก็บข้อมูลผู้ใช้เรียบร้อยแล้ว",$ok_text,"listUser.php","");
				   mysql_close($conn);
				}
	}
?>